package com.right.health.app.bean;

import android.widget.TextView;

import com.right.health.app.R;
import com.right.health.app.app.App;

import java.util.List;

/*
 * Created by hopeliao on 2019-12-08
 *
 */
public class BloodPressureResponse extends PageResponse{

    public static final String TYPE_DAY = "today";
    public static final String TYPE_WEEK = "day7";
    public static final String TYPE_MONTH = "day30";

     public List<BloodPressureInfo> bloodpressures;
     
     public static class BloodPressureInfo {
         public String pulse; //心率
         public String personid;
         public String createtime;
         public String updatetime;

         public String medicalrecordid;
         public String uploaddate;
         public String lowvoltage; //舒张压
         public String highpressure; //收缩压

         public void refreshState(TextView stateTv) {
             float highpressureValue = Float.parseFloat(highpressure); //收缩压
             float lowvoltageValue = Float.parseFloat(lowvoltage); //收缩压

             int textColor = App.getInstance().getResources().getColor(R.color.color_09C3BE);

             StringBuilder sb = new StringBuilder();
             String state = "正常";
             if(highpressureValue < 90) {
                 state = "偏低";
                 textColor = App.getInstance().getResources().getColor(R.color.color_EA3C3C);
             } else if(highpressureValue > 140) {
                 state = "偏高";
                 textColor = App.getInstance().getResources().getColor(R.color.color_EA3C3C);
             }
             sb.append(state);
             sb.append("/");
             if(lowvoltageValue < 60) {
                 state = "偏低";
                 textColor = App.getInstance().getResources().getColor(R.color.color_EA3C3C);
             } else if(lowvoltageValue > 90) {
                 state = "偏高";
                 textColor = App.getInstance().getResources().getColor(R.color.color_EA3C3C);
             }
             sb.append(state);
             stateTv.setTextColor(textColor);
             stateTv.setText(sb.toString());
         }
     }
}
